package com.hyacinth.common.jpql;

import javax.persistence.Query;

public class Limit {
	private Long firstResult;
	private Long maxResult;

	public Limit firstResult(long firstResult) {
		this.firstResult = Long.valueOf(firstResult);
		return this;
	}

	public Limit maxResult(long maxResult) {
		this.maxResult = Long.valueOf(maxResult);
		return this;
	}

	void assign(Query query) {
		query.setFirstResult(this.firstResult.intValue());
		query.setMaxResults(this.maxResult.intValue());
	}
}